package com.itcast.donkey.adapters;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.itcast.donkey.R;
import com.itcast.donkey.modles.ToolBoxModles;

/**
 * Created by lanouhn on 16/9/5.
 */
public class ToolInNameAdapter extends RecyclerView.Adapter<ToolInNameAdapter.NameViewHolder>{
    private Context context;
    private ToolBoxModles.DestinationsBean childrenBean;

    public ToolInNameAdapter(Context context, ToolBoxModles.DestinationsBean childrenBean) {
        this.context = context;
        this.childrenBean = childrenBean;
    }

    @Override
    public NameViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(context).inflate(R.layout.item_tool_showarea,null);
        NameViewHolder holder=new NameViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(NameViewHolder holder, int position) {
        holder.tvItemInName.setText(childrenBean.getChildren().get(position).getName_zh_cn());
    }

    @Override
    public int getItemCount() {
        return childrenBean.getChildren().size();
    }

    public class NameViewHolder extends RecyclerView.ViewHolder {
        private TextView tvItemInName;

        public NameViewHolder(View itemView) {
            super(itemView);
            tvItemInName = (TextView) itemView.findViewById(R.id.tv_item_in_name);
        }
    }
}
